-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug Fix Windows: Remove lmdb files when delete_library
is called
#1437
Conversation
Have you done a bit of manual testing? Can we still create an lmdb library, closed the python interpreter and have that library still readable? Want to be sure we aren't deleting anything inadvertently. Our CI tests probably wouldn't catch it as they all deliberately delete the LMDB database at the end anyway! |
Yes, I have tested that and lmdb library isn't unexpectedly deleted if we close the interpreter. |
…1437) #### Reference Issues/PRs Fixes #1266. The cause of this error was that `LmdbStorage` member `env_` keeps a handle open to the files and windows doesn't delete files if they have been opened by another process. The previous fix was attempting to do `del lib` in python and assuming that this would automatically call the `LmdbStorage` destructor and remove the `env_` handle. `del lib` doesn't guarantee immediate deletion of the library. Therefore on windows delete_library doesn't work as other lmdb has opened the files. #### What does this implement or fix? The fix moves the file removal logic in `LmdbStorage` by adding a new function `close`. The lmdb env handle is closed and this ensures no process has opened the lmdb files, so they are safe to delete. #### Any other comments? #### Checklist <details> <summary> Checklist for code changes... </summary> - [ ] Have you updated the relevant docstrings, documentation and copyright notice? - [ ] Is this contribution tested against [all ArcticDB's features](../docs/mkdocs/docs/technical/contributing.md)? - [ ] Do all exceptions introduced raise appropriate [error messages](https://docs.arcticdb.io/error_messages/)? - [ ] Are API changes highlighted in the PR description? - [x] Is the PR labelled as enhancement or bug so it appears in autogenerated release notes? </details>
Reference Issues/PRs
Fixes #1266. The cause of this error was that
LmdbStorage
memberenv_
keeps a handle open to the files and windows doesn't delete files if they have been opened by another process. The previous fix was attempting to dodel lib
in python and assuming that this would automatically call theLmdbStorage
destructor and remove theenv_
handle.del lib
doesn't guarantee immediate deletion of the library. Therefore on windows delete_library doesn't work as other lmdb has opened the files.What does this implement or fix?
The fix moves the file removal logic in
LmdbStorage
by adding a new functionclose
. The lmdb env handle is closed and this ensures no process has opened the lmdb files, so they are safe to delete.Any other comments?
Checklist
Checklist for code changes...